<?php
$cookie = "mmm.cookie";
$ch = curl_init ();

curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_VERBOSE, 1); //########### debug
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
curl_setopt ($ch, CURLOPT_HTTPHEADER, array("application/x-www-form-urlencoded, */*",
			"Host:www.google.com",
			"Connection:Keep-Alive"));
curl_setopt ($ch, CURLOPT_POST, 1); 
//curl_setopt($ch, CURLOPT_POSTFIELDS,"accountType=HOSTED_OR_GOOGLE&Email=johndoe@gmail.com&Passwd=north23AZ&service=cl&source=Gulp-CalGulp-1.05&logintoken=DQAAAGgA...dkI1LK9&logincaptcha=brinmar");

curl_setopt($ch, CURLOPT_POSTFIELDS,"accountType=GOOGLE&Email=pinus.wu@gmail.com&Passwd=shyguy&service=cl&source=Gulp-CalGulp-1.05&logintoken=DQAAAGgA...dkI1LK9&logincaptcha=brinmar");

$ret = curl_exec ($ch);
flush();
curl_close ($ch);

?>